package com.comunity_cloud.client.view2;

import java.awt.Color;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.border.LineBorder;

import com.comunity_cloud.client.model.CommunityFile;

public class CommunityFilePane extends JPanel{

	/**
	 * 
	 */
	private static final long serialVersionUID = -8633176201219555393L;
	
	
	public CommunityFilePane(CommunityFile file) {
		
		setBorder(new LineBorder(Color.black));
		setBackground(Color.white);
		SpringLayout layout = new SpringLayout();
        setLayout(layout);
        
        
        createProperty("File name:", file.getPath());

        createProperty("Type of file: ", file.getTypeDesc());
        
        createProperty("Size: ",file.getLength()/1024 +" KB");
		        
//        String coma = "";
//        List<CommunityMemberDTO> members = file.getHosts();
//        String value = "";
//		for (CommunityMemberDTO communityMemberDTO : members) {
//			value  += coma+communityMemberDTO.getClient().getUserName();
//			coma = ", ";
//		}
        
//        createProperty("Hosted at: ",value);
        
        
        SpringUtilities.makeCompactGrid(this,
                4, 2, //rows, cols
                6, 6,        //initX, initY
                6, 6);       //xPad, yPad
        
        
        
	}


	private void createProperty(String label, String value) {
		JLabel lbl = new JLabel(label, JLabel.TRAILING);
		add(lbl);
        
        JLabel txt = new JLabel(value);
        add(txt);
	}

}
